package com.gimi.cloud.bbp.dao.myMapper.core.query;


import org.apache.log4j.Logger;

public class QueryParamProvider {
	private static Logger logger = Logger.getLogger(QueryParamProvider.class);

	public String parseSql(QueryParam param) throws Exception
	{
		logger.info("生成sql===>" +  param.getSql());
		return param.getSql();
	}

	public String selectListBySql(QueryParam param) throws Exception
	{
		return param.getSql();
	}

	public String selectOneBySql(QueryParam param) throws Exception
	{
		return param.getSql()+" limit 0,1";
	}

	public String selectCountBySql(QueryParam param) throws Exception{
		//return "select count(1) from ("+param.getSql()+") t";
		return param.getSql();
	}

	/*
	public String pageListBySql(QueryParam param)throws Exception{
		if(null==param.getPage() || null==param.getPageSize()){
			throw new Exception("分页参数不能为空");
		}
		return param.getSql()+" limit "+(param.getPage()-1)*param.getPageSize()+","+param.getPageSize();
	}
	*/

	public String updateSql(QueryParam param) throws Exception
	{
		return param.getSql();
	}

	public String deleteSql(QueryParam param) throws Exception
	{
		return param.getSql();
	}
}
